#ifndef IMSTDAFX_H
#define IMSTDAFX_H

#include <boost/scoped_ptr.hpp>

template <typename T>
class SingletonPacker
{
public:
    SingletonPacker() = default;
    SingletonPacker(const SingletonPacker &) = delete;
    SingletonPacker &operator=(const SingletonPacker &) = delete;

    static T *instance()
    {
        static T instance;
        return &instance;
    }
};

#define IM_CREATE_SINGLETON(Class)                 \
private:                                           \
    friend class SingletonPacker<Class>;           \
                                                   \
public:                                            \
    inline static Class *instance()                \
    {                                              \
        return SingletonPacker<Class>::instance(); \
    }

#define IM_CREATE_PRIVATE(Class) \
private:                         \
    boost::scoped_ptr<Class##Private> d_ptr;

#define IM_CREATE_PROPERTY(Type, Name)          \
private:                                        \
    Type _p##Name;                              \
                                                \
public:                                         \
    Type get##Name() const { return _p##Name; } \
                                                \
public:                                         \
    void set##Name(Type value) { _p##Name = value; }

#endif // IMSTDAFX_H